import { Map } from 'immutable'

import { actionType } from './constants'

const defaultState = Map({
    topBanners:[],
    hotRecommedns:[],
    newAlbums:[]
})
export default function reducer(state = defaultState,action){
    switch(action.type){
        case actionType.CHANGE_TOP_BANNERS :
            // if(!action.topBanners) return  state
            return state.set('topBanners',action.topBanners)
        case actionType.CHANGE_HOT_RECOMMENDS :
            // if(!action.topBanners) return  state
            return state.set('hotRecommedns',action.hotRecommends)
        case actionType.CHANGE_NEW_ALBUMS :
            return state.set('newAlbums',action.newAlbums)
        default:
            return state
    }
}